package com.example.bbook.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.example.bbook.util.HashMapTool;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.HashMap;

@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Data
public class BaseEntity {

    @TableField(exist = false)
    private ArrayList<HashMap<String, Object>> columns;

    public BaseEntity push(String fields, Object type, String title, Object operate) {
        HashMapTool hashMapTool = new HashMapTool();
        columns.add(hashMapTool.getFieldsMap(fields, type, title, operate));
        return this;
    }

    public BaseEntity push(String fields, Object type, String title, Object operate, String[] showKey) {
        HashMapTool hashMapTool = new HashMapTool();
        columns.add(hashMapTool.getFieldsMap(fields, type, title, operate, showKey));
        return this;
    }
}
